import java.util.ArrayList;
import java.util.HashSet;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-11-18
 * Time:20:35
 */
public class TestDemo {
    public static void main(String[] args) {
        ArrayList<Character> array1 = new ArrayList<>();
        char[] arr1 = new char[]{'a','b','a','c','d'};
        for (int i = 0; i < arr1.length; i++) {

            array1.add(i,arr1[i]);

        }
        ArrayList<Character> array2 = new ArrayList<>();
        char[] arr2 = new char[]{'e','f','a','d','g'};
        for (int i = 0; i < arr2.length; i++) {

            array1.add(i,arr2[i]);

        }
        HashSet<Character> set = new HashSet<>();
        set.addAll(array1);
        set.addAll(array2);
        System.out.println(set.toString());


    }

}
